package com.itany.shop.service;

import com.itany.shop.entity.User;
import com.itany.shop.exception.*;

/**
 * @author 石小俊
 */
public interface UserService {

    /**
     * 用户注册
     * @param username 用户名,不能重复
     * @param password 密码,使用MD5加密
     * @param phone    手机号
     * @param address  地址
     */
    void register(String username, String password, String phone, String address) throws RequestParameterErrorException, UserExistException;

    /**
     * 用户登录
     * @param username 用户名
     * @param password 密码,使用MD5加密
     * @return
     */
    User login(String username, String password) throws RequestParameterErrorException, UserNotExistException;

    /**
     * 用户登录,包含验证码
     * @param username
     * @param password
     * @param code
     * @param image
     * @return
     */
    User login(String username,String password,String code,String image) throws RequestParameterErrorException, CodeErrorException, UserNotExistException;

    /**
     * 修改密码
     * @param user
     * @param oldPassword
     * @param newPassword
     * @param newPassword2
     */
    void modifyPassword(User user, String oldPassword, String newPassword, String newPassword2) throws UserNotExistException, PasswordErrorException;
}
